import unittest
import time
from selenium import webdriver
from selenium.webdriver.common.by import By
from Po_kaoshi.Podemo.Page import Page
from Po_kaoshi.Podemo.Pgae2 import Page2

class TestCase(unittest.TestCase):
    def setUp(self):
        self.driver = webdriver.Chrome()
        self.driver.maximize_window()

    def tearDown(self):
        self.driver.quit()


    def test_luoji(self):
        po=Page(self.driver)
        po.open_url('http://localhost:8080/additem')
        time.sleep(2)
        po.xuesheng()
        time.sleep(2)
        po.laoshi()
        time.sleep(2)
        po.kecheng()
        time.sleep(2)
        po.caozuo()
        time.sleep(2)
        duanyan01 = self.driver.find_element(By.XPATH, '/html/body/div[1]/div/section/section/main/form/div[7]/div/button[2]').text
        self.assertEqual(duanyan01, '重置')
        po.tijia()
        time.sleep(2)

    def test_luoji2(self):
        po=Page2(self.driver)
        po.open_url('http://localhost:8080/loging')
        time.sleep(2)
        po.zhanghao()
        time.sleep(2)
        po.mima()
        time.sleep(2)
        duanyan02=self.driver.find_element(By.XPATH,'/html/body/div[1]/div/section/section/main/div/div[2]/div[3]/label[1]/span[2]').text
        self.assertEqual(duanyan02,'保持登录')
        po.denglu()
        time.sleep(2)


if __name__ == '__main__':
    unittest.main()